<?php
namespace app\api\model;

use app\common\model\Banner as BannerModel;

/**
 * 首页banner模型
 * Class Banner
 * @package app\api\model
 */
class Banner extends BannerModel
{
    /**
     * 获取首页banner
     * @param int $limit
     * @return bool|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function getList($limit = 10)
    {
        return static::with(['image'])
            ->where('is_delete', '=', 0)
            ->where('banner_status', '=', 1)
            ->order(['banner_sort' => 'asc', 'create_time' => 'desc'])
            ->limit($limit)
            ->select();

    }
}